package demo01;
import java.util.concurrent.TimeUnit;
public class YootkDemo03 {
    public static int money = 0 ;
    public static void main(String[] args) throws   Exception {
        int[] data = new int[]{100, 200, 300};
        for (int i = 0; i < data.length; i++) {
            final  int temp = i;
            new Thread(() -> {
                try {
                    TimeUnit.MICROSECONDS.sleep(100);
                } catch (InterruptedException e) {}
                money += data[temp];
            }).start();
        }
        TimeUnit.SECONDS.sleep(1);
        System.out.println("结果：" + money);
    }
}
